import React, {Component} from 'react'
import {
    Image,
    StyleSheet,
    Text,
    TouchableOpacity,
    TouchableHighlight,
    View,
    ScrollView,
    NativeAppEventEmitter,
    Platform,
    StatusBar,
} from 'react-native';

import RemoteClient from '../../network/RemoteClient';

export default class PageTwo extends Component {
  constructor(props) {
    super(props);
    this.remoteClient = new RemoteClient();
    this.state = {
      body: []
    };
  }

  getJsonObject() {
    this.remoteClient.getJsonObject()
    .then(data => {
      this.setState({body: data._bodyText});
    })
    .catch(error => alert("====\n" + error.message));
  }

  render() {
    return(
      <View>
        <Text>
          {this.getJsonObject()}
          {this.state.body}
        </Text>
      </View>
    );
  }
}
